package com.skwen.android_room.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;

import com.skwen.android_room.bean.Books;

import java.util.List;

@Dao
public interface BooksDao {

    @Query("select * from books")
    List<Books> getAll();

    @Query("select * from books where id is :id")
    Books findOneById(Long id);

    @Query("select * from books where id in (:ids)")
    List<Books> findAllById(long[] ids);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insertBooks(Books... books);

    @Delete
    void deleteBook(Books books);

}
